<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('certs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('company_id')->default(0);
            $table->unsignedBigInteger('user_id')->index()->default(0);
            $table->string('title')->nullable()->comment('资质类型/证书名称/专利名称');
            $table->string('aptitude')->nullable()->default('/')->comment('资质类别/证书类别/专利类型');
            $table->string('company')->nullable()->default('/')->comment('企业名称');
            $table->string('patent_number')->nullable()->default('/')->comment('证书编号');
            $table->string('type')->default(0)->comment('0企业 1证书 2职称');
            $table->string('numbers')->nullable();
            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();
            $table->tinyInteger('date_type')->default(1)->comment('1长期;0非长期');
            $table->string('files')->nullable();
            $table->string('level')->nullable()->default('/')->comment('资格等级');
            $table->string('major')->nullable()->default('/')->comment('专业');
            $table->date('acquired_at')->nullable()->comment('资格取得时间/授予时间');
            $table->string('approving_unit')->nullable()->default('/')->comment('批准单位');
            $table->string('licence')->nullable()->default('/')->comment('发证机关');
            $table->string('jury_name')->nullable()->default('/')->comment('评委会名称');
            $table->string('inventor')->nullable()->default('/')->comment('发明人');
            $table->string('patent_owner')->nullable()->default('/')->comment('专利权所有人');
            $table->string('nationality')->nullable()->default('/')->comment('国别');
            $table->string('remarks')->nullable()->default('/');
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('certs');
    }
};
